<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
	<title>中小企业</title>
    <link rel="stylesheet" href="${root}/res/weui/dist/style/weui.css"/>
    <link rel="stylesheet" href="${root}/res/weui/dist/style/weui.ex.css"/>
    <link rel="stylesheet" href="${root}/res/jsLib/weixin/weixin.css"/>
    <script src="${root}/res/weui/dist/js/zepto.min.js"></script>
    <script src="${root}/res/jsLib/weixin/weixin.js"></script>
    <script type="text/javascript">
	    $(function () {
	    	var loadList = function(){
	    		$("#serviceList").empty();
	    		$("#moreBtn").attr('pageNo','0').attr('pageCount','1');
		    	wxUtils.loadDataPage({
		    		urlFun:function(pageNo){
		    			return JSON.stringify({"service_new_type1": $("#typeBtn").attr("value"),"service_new_type2": "",
		    				"areacode":$("#areaBtn").attr("value"),"serviceName":$("#searchInput").val(),"pageNo": pageNo,"method":"findService"});
		    		},
		    		showFun:function(data){
		    			$.each(data.datalist,function(index,info){
		    				var url = '/weixin/service/content.do?id='+info['ID']+'&sx_area2='+info['SX_AREA2']+'&avgvalue='+info['AVGVALUE'];
							var a  = $('<a href="javascript:wxUtils.load(\''+url+'\')" class="weui-media-box weui-media-box_appmsg" id="'+info['ID']+'"/>').appendTo($("#serviceList"));
							var hd = $('<div class="weui-media-box__hd"/>').appendTo(a);
							var img = $('<img class="weui-media-box__thumb" src="${root}/res/weui/dist/img/servcie-img.png" alt=""/>').appendTo(hd);
							var bd = $('<div class="weui-media-box__bd"/>').appendTo(a);
							$('<h4 class="weui-media-box__title"/>').appendTo(bd).html(info['SERVICE_NAME']);
							var content='<div>'+wxUtils.titleFormat(info['SERVICE_PROCESS'])+'</div>';
							$('<p class="weui-media-box__desc"/>').appendTo(bd).html(content);
							var ul = $('<ul class="weui-media-box__info_e"/>').appendTo(bd);
							$('<ul class="weui-media-box__info_e"/>').appendTo(bd);
							$('<li class="weui-media-box__info__meta"/>').appendTo(ul).html(info['SX_AREA2']);
							$('<li class="weui-media-box__info__meta"/>').appendTo(ul).html(info['TYPE_NAME1']);
			    			if(info['AVGVALUE'] && $.trim(info['AVGVALUE'])!='null'){
			    				 $('<li class="weui-media-box__info__meta"/>').appendTo(ul).html(info['AVGVALUE']+'星');
			    			}
							$('<li class="weui-media-box__info__meta"/>').appendTo(ul).html(info['AUDIT_TIME'].substring(5,10));
						});
		    		}
		    	});
	    	}
	    	loadList();
	    	
	    	//初始化行政区划选项
	    	$("#areaBtn").click(function(){
	    		$("#areaSelect").fadeIn(200);
	    	});
	    	$("#areaSelect").find('.weui-actionsheet__cell').click(function(){
	    		$("#areaSelect").fadeOut(100);
	    		var regionCode = $(this).attr('value');
	    		var regionName = $(this).text();
	    		$("#areaBtn").attr('value',regionCode).html(regionName+'<i class="weui-icon-search"></i>');
	    		loadList();
	    	});
	    	//初始化服务分类选项
	    	wxUtils.loadDicData({
	    		dicName:'serviceType',
	    		urlFun:function(){
	    			return JSON.stringify({"method":"bigservice"});
	    		},
	    		showFun:function(data){
	    			$.each(data.datalist,function(index,info){
	    				$("#typeSelect").find('.weui-actionsheet__menu').append('<div class="weui-actionsheet__cell" value="'+info['SERVICE_TYPE_CODE']+'">'+info['SERVICE_TYPE_NAME']+'</div>');
	    			});
	    	    	$("#typeBtn").click(function(){
	    	    		$("#typeSelect").fadeIn(200);
	    	    	});
	    	    	$("#typeSelect").find('.weui-actionsheet__cell').click(function(){
	    	    		$("#typeSelect").fadeOut(100);
	    	    		var code = $(this).attr('value');
	    	    		var name = $(this).text();
	    	    		$("#typeBtn").attr('value',code).html(name+'<i class="weui-icon-search"></i>');
	    	    		loadList();
	    	    	});
	    		}
	    	});
	    	//搜索服务名称事件
	    	$("#searchInput").blur(function(){
	    		loadList();
	    	});
	    	wxUtils.initSearchBar();
	    	wxUtils.iniScrollBar();
	    });
	</script>
</head>
<body>

	<div class="page wxbg">
		<div class="weui-tab__panel detail_panel">
		
		</div>
	    <div class="weui-tab__panel list_panel">
			<div class="weui-navbar" position="top">
				<div class="weui-search-bar weui-navbar" id="searchBar">
				    <form class="weui-search-bar__form">
				        <div class="weui-search-bar__box">
				            <i class="weui-icon-search"></i>
				            <input type="search" class="weui-search-bar__input" id="searchInput" placeholder="搜索" />
				            <a href="javascript:" class="weui-icon-clear" id="searchClear"></a>
				        </div>
				        <label for="search_input" class="weui-search-bar__label" id="searchText">
				            <i class="weui-icon-search"></i>
				            <span>搜索</span>
				        </label>
				    </form>
				    <a href="javascript:" class="weui-search-bar__cancel-btn" id="searchCancel">取消</a>
				</div>
			    <a href="javascript:" class="weui-search-bar__cancel-btn" id="searchCancel">取消</a>
		    </div>
		    <div class="weui-tab__panel">
				<div class="weui-panel weui-panel_access" position="center">
			    	<div class="weui-panel__hd">社会服务-<span id="areaBtn" value="">全市<i class="weui-icon-search"></i></span>-<span id="typeBtn" value="">全部分类<i class="weui-icon-search"></i></span></div>
			        <div class="weui-panel__bd" id="serviceList">
			       		
				    </div>
				    <jsp:include page="/WEB-INF/pages/weixin/page.jsp"></jsp:include>
				</div>
			</div>
		</div>
		<jsp:include page="/WEB-INF/pages/weixin/bottom.jsp?menu=2"></jsp:include>
	</div>
	<!-- 行政区划选择 -->
	<div class="weui-skin_android" id="areaSelect" style="display: none">
        <div class="weui-mask"></div>
        <div class="weui-actionsheet">
            <div class="weui-actionsheet__menu">
                <div class="weui-actionsheet__cell" value="">全市</div>
                <div class="weui-actionsheet__cell" value="441600">市辖区</div>
                <div class="weui-actionsheet__cell" value="441602">源城区</div>
                <div class="weui-actionsheet__cell" value="441621">紫金县</div>
                <div class="weui-actionsheet__cell" value="441622">龙川县</div>
                <div class="weui-actionsheet__cell" value="441623">连平县</div>
                <div class="weui-actionsheet__cell" value="441624">和平县</div>
                <div class="weui-actionsheet__cell" value="441625">东源县</div>
            </div>
        </div>
    </div>
    <!-- 服务分类选择 -->
	<div class="weui-skin_android" id="typeSelect" style="display: none">
        <div class="weui-mask"></div>
        <div class="weui-actionsheet">
            <div class="weui-actionsheet__menu">
                <div class="weui-actionsheet__cell" value="">全部分类</div>
            </div>
        </div>
    </div>
    
                        
</body>
</html>

